package org.example.studentsdemo.course.controller;


import org.example.studentsdemo.course.entity.course;
import org.example.studentsdemo.teachers.DTO.addStudentsToTeacherDTO;
import org.example.studentsdemo.teachers.entity.teachers;
import org.example.studentsdemo.course.service.courseService;
import org.example.studentsdemo.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/course")
public class courseController {

      @Autowired
      private courseService courseService;


      @GetMapping("/getCourseList")
    public ResponseEntity<HttpResult<List<course>>> getCourseList() {
        return  courseService.getCourseList();
      }
    @GetMapping("/getCourseById")
    public ResponseEntity<HttpResult<course>> getCourseById(@RequestParam Long id) {
        return  courseService.getCourseById(id);
    }
    @PostMapping("/addCourse")
    public ResponseEntity<HttpResult<course>> addCourse(@RequestBody course course) {
        return  courseService.addCourse(course);
    }
    @PostMapping("/updateCourse")
    public ResponseEntity<HttpResult<course>> updateCourse(@RequestBody course course) {
        return  courseService.updateCourse(course);
    }
    @PostMapping("/deleteCourse")
    public ResponseEntity<HttpResult<Boolean>> deleteCourse(@RequestBody Long id) {
        return  courseService.deleteCourse(id);
    }


}
